<!DOCTYPE html>
<html lang="zh">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>波浪下划线效果</title>
  </head>
  <body>
    <div style="width:500px ;margin: 100px auto;">
      <div class="box">静态css: 文字下面有波浪线</div>

      <div class="wavy">动态css(使用svg绘制):鼠标移上来</div>
    </div>
  </body>
  <style>
    .box {
      text-decoration: underline;
      text-decoration-style: wavy;
    }

    .wavy {
      margin-top: 100px;
      display: inline-block;
      text-decoration: underline;
      /* 静态下划线 */
      text-underline-offset: 5px;
      /* 调整svg动态波浪距离 */
      padding-bottom: 5px;
    }

    .wavy:hover {
      background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 4'%3E%3Cpath fill='none' stroke='%23333' d='M0 3.5c5 0 5-3 10-3s5 3 10 3 5-3 10-3 5 3 10 3'/%3E%3C/svg%3E")
        repeat-x 0 100%;
      background-size: 20px auto;
      text-decoration: none;
      animation: waveMove 1s infinite linear;
    }

    @keyframes waveMove {
      from {
        background-position: 0 100%;
      }
      to {
        background-position: -20px 100%;
      }
    }
  </style>
</html>
